<?=view('admin.common.header')?>
<?=view('admin.common.nav')?>
<div class="container">
    <div class="row">
        <?php if($users && count($users)): ?>
        <div class="panel panel-default">
            <div class="panel-heading">
                用户列表 　　<kbd>共 <?= $countuser ?> 用户</kbd>
            </div>
            <table class="table table-bordered">
                <thead>
                    <tr>
                        <th>昵称</th>
                        <th>注册时间</th>                        
                        <th>身份证姓名</th>
                        <th>身份证号码</th>
                        <th>联系电话</th>
                        <th>#</th>
                    </tr>
                </thead>
                <tbody>
                    <?php foreach ($users as $val): ?>
                    <tr>
                        <td><?=  $val->nickname?></td>
                        <td><?=  $val->strRegTime()?></td>
                        <td><?=  $val->name?></td>
                        <td><?=  $val->cardnumber?></td>
                        <td><?=  $val->phone?></td>
                        <td>
                            <?php if ($val->isver == 0 && $val->name != '' && $val->cardnumber != ''): ?>
                            <a class="btn btn-xs btn-primary eveModify" data-info="身份证信息正确吗" href="<?= url("/admin/user/edit/{$val->id}/1") ?>">确认</a>
                            <?php endif; ?>
                            <?php if ($val->isinsp == 0): ?>
                            <a class="btn btn-xs btn-primary eveModify" data-info="确认设置为装维人员" href="<?= url("/admin/user/editzw/{$val->id}/1") ?>">设置装维</a>
                            <?php endif; ?>
                            <?php if ($val->isinsp == 1): ?>
                            <a class="btn btn-xs btn-primary eveModify" data-info="确认取消" href="<?= url("/admin/user/editzw/{$val->id}/0") ?>">取消装维</a>
                            <?php endif; ?>
                            <a class="btn btn-xs btn-danger eveDel" data-info="确认删除" href="<?= url("/admin/user/deluser/{$val->id}") ?>">删除</a>
                        </td>
                    </tr>
                    <?php endforeach; ?>
                </tbody>
            </table>
        </div>
        <?=$users->render()?>
        <?php endif; ?>
    </div>
</div>
<script>
    $('.eveModify, .eveDel').click(function() {
        var $url = $(this).attr('href'), info = $(this).attr('data-info');
        layer.confirm(info, {icon: 3, title:info}, function(index){
            $.get($url, function(data){
               layer.msg(data.info);
               if(data.status == 1) {
                   window.location.reload();
               }
            });
            layer.close(index);
        });
        return false;
    });
</script>

<?=view('admin.common.footer')?>